# -*- coding:utf-8 -*—
import math
import os
import time

import pandas as pd
from pandas import DataFrame

def readExcel(excelPath):
    df: DataFrame = pd.read_excel(io=excelPath)
    return df

def exportExcel(open_path,df):
    filename = os.path.basename(open_path)
    # print(os.path.basename(path))

    stem, suffix = os.path.splitext(filename)
    # print(stem)  # test
    # print(suffix)  # .py
    exportPath = os.path.split(os.path.abspath(open_path))[0]
    now_time = time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime())
    outname = "/"+stem+"NEW" + now_time + ".xlsx"
    # print(outname)
    outputPath = exportPath +outname
    # outputPath = exportPath +'./excel转txt1.txt'
    # df.to_excel(outputPath, sep='\t', index=None)
    # df.to_excel(outputPath,index = False,encoding="utf-8")
    df.to_excel(outputPath,index = False)
    # print('导出excel完成')